﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace QiangPiao.Person
{
    public class XmlSerialiaze
    {
        public void Serialiaze(List<Persons> pList)
        {
            XmlSerializer xs = new XmlSerializer(typeof(pList));
            Stream stream = new FileStream("c:\\cyj.xml", FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
            xs.Serialize(stream, c);
            stream.Close();
        }
        //反序列化
        public void Deserialize()
        {
            XmlSerializer xs = new XmlSerializer(typeof(Person));
            Stream stream = new FileStream("c:\\cyj.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            Person p = (Person)xs.Deserialize(stream);
           
        }
    }

}

